HAL DCACHE migration: List of applicable concepts

This section provides information about the HAL DCACHE applicable architecture concepts.

Concepts for DCACHE

Concept

Description

Renaming of the handle structure

DCACHE_HandleTypeDef has been renamed to: hal_dcache_handle_t.

Remove MspInit and MspDeInit callbacks

HAL_DCACHE_MspInit and HAL_DCACHE_MspDeInit are no longer available and have been replaced by a user sequence to initializes and configures the DCACHE.

Introduction of HAL user data set/get APIs

Two functions to set and get user data are available: HAL_DCACHE_SetUserData / HAL_DCACHE_GetUserData.

Individual callback registration APIs replace global register and unregister functions

The callback registration is handled by specific functions for each DCACHE event. These functions are used to register callback functions for different DCACHE events.

Removal of hardware-related macros in HAL2

All hardware macros have been removed from the HAL DCACHE driver, and equivalent services are ensured through the LL APIs.

Revised and optimized HAL state machine

The DCACHE state machine is reworked to ensure transitions of the peripheral functional states.

Revised and optimized HAL API status returns

The HAL DCACHE functions were updated to return:

  • HAL_INVALID_PARAM: in case of a NULL p_config structure pointer.

  • HAL_ERROR: in case of an error.

  • HAL_TIMEOUT: in case of a user timeout.

  • HAL_BUSY: in case of an ongoing process.

  • HAL_OK: in case of a successfully completed operation.

Revised and optimized HAL error management

The HAL error handling mechanisms have been redesigned to improve the detection, reporting, and handling of errors. This provides more detailed and consistent error information.

Replaced TypeDef suffix with _t in type names

All TypeDef parts of the HAL DCACHE driver have been removed and replaced by _t.

Replaced nonmodifiable pointers with const keywords

Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable.

Assertion implementation and usage in HAL1

The parameters and state are checked using ASSERT_DBG_STATE and ASSERT_DBG_PARAM macros.

Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.

Finite parameters (including DCACHE instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety.

Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).

HAL DCACHE resources and data structures are started with the prefix HAL.

Other HAL DCACHE changes

Concept

Consideration

Replace address parameters so that the address is passed as a value rather than as a pointer.

Change the parameter type from const uint32_t *const to uint32_t.

Example :

  • HAL_DCACHE_CleanInvalidByAddr(hal_dcache_handle_t *hdcache, uint32_t  addr, uint32_t size)

  • The const uint32_t *const pAddr has been changed to uint32_t addr

Add new services to manage the Burst configuration

Add HAL_DCACHE_GetReadBurstType function